#include "Grass.h"
#include "ResourceManager.h"
#include <d3dx9.h>

Grass::Grass(int id, float x, float y, int type)
{
	switch (type)
	{
	case 3:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Left),0, 0);
		break;
	case 4:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Middle),0, 0);
		break;
	case 42:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Left_2),0, 0);
		break;
	case 43:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Middle_2),0, 0);
		break;
	case 44:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Right_2),0, 0);
		break;
	case 5:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Right),0, 0);
		break;
	case 61:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Left_3),0, 0);
		break;
	case 62:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Middle_3),0, 0);
		break;
	case 63:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Grass_Right_3),0, 0);
		break;
	}
	_id = id;
	_x = x;
	_y = y;
	_width = _sprite->getTexture()->getWidth();
	_height = _sprite->getTexture()->getHeight();
}

Grass::~Grass(void)
{
	if (_sprite)
	{
		delete _sprite;
	}
	
}

void Grass::Update(list<Object *> *_list, float time)
{
}


void Grass:: Render(int vpX, int vpY)
{
	_sprite->Render(_x, _y, vpX, vpY);
}

OBJECT_TYPE Grass::getObjectType()
{
	return OBJECT_LAND;
}